<?php

include_once('../dao/UnidadeDAO.php');
new Conexao(); // Paamayim Nekudotayim

if(isset($_POST['ok'])){

    $um = new Unidade;
    $um->setNome($_POST['nome']);
    $um->setSigla($_POST['sigla']);

    if(UnidadeDAO::inserir($um)){
        header("location: ../include/confirma.php?msg=".urlencode("Adicionando novo item..."));
        exit;
    }
}

include(dirname(dirname(__FILE__)).'\include\coments.php');?>
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
    <?php include('head.php'); ?>
    <body style="margin-top:0;">
        <form method="post" name="form" onsubmit="return verificarUM();">
            <table>
                <tr>
                    <th colspan="2">Adicionar Nova U.M.</th>
                </tr>
                <tr>
                    <td>Nome:</td>
                    <td><input name="nome" size="20" /></td>
                </tr>
                <tr>
                    <td>Sigla:</td>
                    <td><input name="sigla" size="5" /></td>
                </tr>
                <tr>
                    <td colspan="2"><input name="ok" type="submit" value="Adicionar" />&nbsp;
                    <input type="button" value="Fechar" onclick="fechar(0);" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>
